import getState from "@/api/state";
import HorizontalBarChart from "@/template/HorizontalBarChart/HorizontalBarChart";
import React from "react";
import { useEffect } from "react";
import { useState } from "react";

const Home6 = ({ condition }) => {
    const [message, setMessage] = useState("暂无数据");
    const [loading, setLoading] = useState(false)
    const [state, setState] = useState({
        data: []
    })


    useEffect(() => {
        getState({
            apiUrl: "/cifgp-core-api/synt/monthAndYear",
            state,
            condition: { ...condition, cType: "syntcustRetention" },
            setState,
            setLoading,
            setMessage
        })
    }, [condition])


    return (
        <>
            <HorizontalBarChart
                message={message}
                loading={loading}
                style={{ width: "25%", }}
                sort={"up"}
                // btn={["全险种", "车险", "意健险", "财产险"]}
                title="各险种客户留存率"
                data={[
                    state
                ]}
                
                unit="客户量"
                tooltips={false}
                fieldNames={{
                    show: false,
                    name: "留存客户量",
                    nameAll: true,
                    value: "个"
                }}
                titleTips="留存的客户量占比"
            />
        </>
    )
}
export default Home6;